package day5;


public class Find {
    public static void main(String[] args) {
        int nums[] = {1, 2, 3, 4, 7,6,5,8};
        int largest = nums[0];
        int secondLargest = nums[0];
        int index=0;
        for (int i=0;i< nums.length;i++) {
            if (nums[i] > largest) {
                secondLargest = largest;
                largest = nums[i];
                index=i;
            }
        }
        System.out.println("第二大值为："+secondLargest+"下标为:"+index);
    }
}
